<template>
  <div class="">
    <el-container style="height: 100%; border: 1px solid #eee">
      <el-aside
        class="asideM"
        width="200px"
        style="background-color: rgb(238, 241, 246)"
      >
        <el-menu  style="margin-top:60px">
          <el-menu-item-group>
            <el-menu-item index="1-1" @click="toCount">销售统计</el-menu-item>
            <el-menu-item index="1-2" @click="toItemsInfo">商品管理</el-menu-item>
          </el-menu-item-group>
        </el-menu>
      </el-aside>

      <el-container>
        <el-header class="headerM">
          <div style=" display: flex;">
            <span
              style="text-align: left; font-size: 18px;width:70%; font-weight: bolder;"
              >LOVO商城前端管理</span
            >
            <div>
              <span style="text-align: right; font-size: 16px;width:300px">{{
                user.userRealName
              }}</span
              >|<a href="javascript:void(0)" @click="exit">注销</a>
            </div>
          </div>
        </el-header>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import { removeSession } from "../../service/user";
import { mapState } from "vuex";
export default {
  components: {},
  data() {
    return {};
  },
  computed: { ...mapState("cart", ["user"]) },
  methods: {
    exit() {
      this.$confirm("确认是否安全退出?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          removeSession();
          this.$router.push({ path: "/login" });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消",
          });
        });
    },
    toCount() {
      this.$router.push("/manage/Count");
    },
    toItemsInfo(){
      this.$router.push("/manage/items");
    }
  },
  mounted() {},
  created() {},
};
</script>

<style>
.headerM {
  background-color: #b3c0d1;
  color: #333;
  line-height: 60px;
}

.asideM {
  color: #333;
}
</style>
